/* 知识图谱管理系统样式 */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.header .container-fluid {
    position: relative;
    z-index: 1;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header h1 i {
    margin-right: 15px;
    color: #ffd700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 搜索容器 */
.search-container {
    position: relative;
}

.search-container .input-group {
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 25px;
    overflow: hidden;
}

.search-container .form-control {
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    background: rgba(255,255,255,0.95);
}

.search-container .form-control:focus {
    box-shadow: none;
    background: white;
}

.search-container .btn {
    border: none;
    padding: 12px 15px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-container .btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* 统计面板 */
.stats-panel {
    background: white;
    border-radius: 15px;
    padding: 12px;
    margin: 10px 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.stat-item {
    padding: 8px;
    text-align: center;
}

.stat-item h5 {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

/* 控制面板 */
.control-panel {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.control-panel .btn {
    border-radius: 20px;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.control-panel .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* 图谱容器 */
.graph-container {
    position: relative;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    min-height: 800px;
    height: calc(100vh - 220px);
}

.graph-chart {
    width: 100%;
    height: 100%;
    min-height: 800px;
    position: relative;
}

.graph-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    max-width: 250px;
    z-index: 100;
}

.graph-info .info-item {
    font-size: 0.85rem;
}

.graph-info ul {
    margin: 8px 0 0 0;
    padding-left: 15px;
}

.graph-info li {
    margin-bottom: 3px;
    color: #666;
}

/* 模态框样式 */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    border-radius: 15px 15px 0 0;
    padding: 20px 25px;
    border-bottom: none;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: none;
    padding: 20px 25px;
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-title i {
    margin-right: 10px;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

/* 按钮样式 */
.btn {
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.btn-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
}

/* 表格样式 */
.table {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0;
}

.table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    padding: 15px 12px;
}

.table td {
    padding: 12px;
    border: none;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
}

.table-responsive {
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 消息提示 */
.alert {
    border: none;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 15px 0;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
}

.alert-success {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.1) 0%, rgba(56, 239, 125, 0.1) 100%);
    color: #0f5132;
    border-left: 4px solid #11998e;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(255, 65, 108, 0.1) 0%, rgba(255, 75, 43, 0.1) 100%);
    color: #842029;
    border-left: 4px solid #ff416c;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .control-panel {
        justify-content: center;
    }
    
    .control-panel .btn {
        margin: 3px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .graph-chart {
        height: calc(100vh - 300px);
        min-height: 400px;
    }
    
    .graph-container {
        height: calc(100vh - 300px);
        min-height: 400px;
    }
    
    .graph-info {
        position: static;
        margin: 15px;
        max-width: none;
    }
    
    .stats-panel .row > div {
        margin-bottom: 15px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .header {
        padding: 15px 0;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .search-container .form-control,
    .search-container .btn {
        padding: 8px 12px;
    }
    
    .stats-panel {
        padding: 15px;
        margin: 15px 0;
    }
    
    .modal-dialog {
        margin: 10px;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.stats-panel,
.graph-container,
.modal-content {
    animation: fadeInUp 0.6s ease-out;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 节点高亮样式 */
.node-highlighted {
    animation: pulse 2s infinite;
}

/* 自定义滚动条 */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* 工具提示 */
.tooltip-inner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* 智能构建功能样式 */
.example-texts .btn {
    margin: 2px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.example-texts .btn:hover {
    transform: translateY(-1px);
}

#tripletsPreview {
    animation: fadeInDown 0.5s ease-out;
}

#tripletsPreview .table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

#tripletsPreview .badge {
    font-size: 0.75rem;
    padding: 4px 8px;
}

#analysisResult {
    animation: fadeInUp 0.5s ease-out;
}

#analysisResult .alert {
    border: none;
    border-radius: 10px;
}

#analysisResult details {
    margin-top: 10px;
}

#analysisResult summary {
    cursor: pointer;
    font-weight: 600;
    color: #666;
}

#analysisResult summary:hover {
    color: #333;
}

/* 智能构建按钮特殊样式 */
.btn-danger.btn-sm {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border: none;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-danger.btn-sm:hover {
    background: linear-gradient(135deg, #ee5a6f 0%, #ff6b6b 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

/* 文本分析区域 */
#analysisText {
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
}

#analysisText:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 107, 0.25);
}

/* 关系标准化选项样式 */
#normalizeRelations {
    cursor: pointer;
}

#normalizeRelations:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-label {
    cursor: pointer;
}

/* 清空数据按钮特殊样式 */
.btn-warning {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border-color: #ff6b35;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-warning:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.3);
}

/* 危险操作确认动画 */
@keyframes dangerPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 107, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
}

.btn-warning.danger-confirm {
    animation: dangerPulse 1.5s infinite;
}

/* 加载状态优化 */
.alert-info .loading {
    border-color: #b8daff #b8daff #b8daff transparent;
}

/* 三元组表格样式 */
.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

.table-bordered thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 700;
    color: #495057;
    text-align: center;
}

.table-sm td {
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

/* 动画效果 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 图表容器内的提示信息 */
.graph-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    z-index: 50;
}

.graph-loading .loading {
    margin-bottom: 15px;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

.empty-state h4 {
    color: #999;
    margin-bottom: 10px;
}

.empty-state p {
    color: #bbb;
    font-size: 0.9rem;
}